(define-module (ton-tull)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix utils)
  #:use-module (guix gexp)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system perl)
  #:use-module (guix build-system cmake)
  #:use-module (guix build-system ant)
  #:use-module (guix build-system haskell)
  #:use-module (guix build-system glib-or-gtk)
  #:use-module (guix build-system trivial)
  #:use-module (guix build-system meson)
  #:use-module (guix build-system python)
  #:use-module (guix build-system cargo)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (gnu packages)
  #:use-module (gnu packages base)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages readline)
  #:use-module (gnu packages aspell)
  #:use-module (gnu packages tor)
  #:use-module (gnu packages image)
  #:use-module (gnu packages tbb)
  #:use-module (gnu packages video)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages gnupg)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages libreoffice)
  #:use-module (gnu packages xml)
  #:use-module (gnu packages check)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages popt)
  #:use-module (gnu packages protobuf)
  #:use-module (gnu packages maths)
  #:use-module (gnu packages web)
  #:use-module (gnu packages web-browsers)
  #:use-module (gnu packages python)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages logging)
  #:use-module (gnu packages sdl)
  #:use-module (gnu packages gnuzilla)
  #:use-module (gnu packages boost)
  #:use-module (gnu packages crypto)
  #:use-module (gnu packages pciutils)
  #:use-module (gnu packages xorg)
  #:use-module (gnu packages guile)
  #:use-module (gnu packages fontutils)
  #:use-module (gnu packages documentation)
  #:use-module (gnu packages pth)
  #:use-module (gnu packages qt)
  #:use-module (gnu packages python)
  #:use-module (gnu packages xiph)
  #:use-module (gnu packages upnp)
  #:use-module (gnu packages audio)
  #:use-module (gnu packages python-web)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages php)
  #:use-module (gnu packages assembly)
  #:use-module (gnu packages fribidi)
  #:use-module (gnu packages networking)
  #:use-module (gnu packages elf)
  #:use-module (gnu packages mp3)
  #:use-module (gnu packages wm)
  #:use-module (gnu packages crates-io)
  #:use-module (gnu packages version-control)
  #:use-module (gnu packages xiph)
  #:use-module (gnu packages game-development)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages graphics)
  #:use-module (gnu packages man)
  #:use-module (gnu packages freedesktop)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages gl)
  #:use-module (gnu packages gnunet)
  #:use-module (gnu packages games)
  #:use-module (gnu packages glib))

(define-public perl-thread-qeue
  (package
    (name "perl-thread-qeue")
    (version "3.13")
    (source
     (origin
       (method url-fetch)
       (uri (string-append "https://cpan.metacpan.org/authors/id/J/JD/JDHEDDEN/Thread-Queue-3.13.tar.gz"))
       (sha256
        (base32
         "1s6wpxy07mr03krkzjr5r02cswsj18dd38aa5f16dfrgvp6xm8vb"))))
    (build-system perl-build-system)
    (home-page "https://metacpan.org/pod/Thread::Queue")
    (synopsis "")
    (description "")
    (license (package-license perl))))

(define-public perl-extutils-makemaker
  (package
    (name "perl-extutils-makemaker")
    (version "7.44")
    (source
     (origin
       (method url-fetch)
       (uri "https://cpan.metacpan.org/authors/id/B/BI/BINGOS/ExtUtils-MakeMaker-7.44.tar.gz")
       (sha256
        (base32
         "123ii0w3b6nszl68sh34n39lyfwdnz99sj976mgsy3r5f618z8aj"))))
    (build-system perl-build-system)
    (home-page "https://metacpan.org/pod/ExtUtils::MakeMaker")
    (synopsis "")
    (description "")
    (license (package-license perl))))


(define-public opencv
  ;; Build instructions and dependencies:
  ;; https://docs.opencv.org/trunk/d7/d9f/tutorial_linux_install.html
  (package
   (name "opencv")
   (version "3.4.1")
   (source (origin
             (method git-fetch)
             (uri (git-reference
                   (url "https://github.com/opencv/opencv")
                   (commit "6ffc48769ac60d53c4bd1913eac15117c9b1c9f7")))
;;      (string-append "https://github.com/opencv/opencv/archive/"
;;                     version ".zip"))
;;     (file-name (string-append name "-" version ".tar.gz"))
     (sha256
      (base32
       "0lwidq5gj81nb11icnxiym43zl63rqj7lbvblsr0wmashkpiam8r"
       ))))
   (build-system cmake-build-system)
;;; dsable tests? Maybe?
   (inputs `(("zlib" ,zlib)
             ("python" ,python-2)
             ("python2-numpy" ,python2-numpy)
             ("libjpeg" ,libjpeg-turbo)
             ("libtiff" ,libtiff)
             ("jasper" ,jasper)
             ("libpng" ,libpng)
             ("tbb" ,tbb)
             ("ffmpeg" ,ffmpeg)
             ("pkg-config" ,pkg-config)
             ("gtk+" ,gtk+)
             ))
   (synopsis "TODO")
   (description "TODO")
   (home-page "https://opencv.org/")
   (license license:gpl2)))

(define-public caffe
  (package
   (name "caffe")
   (version "1.0") ;; ?? Check, is there a newer one now?
   (source
    (origin
     (method url-fetch)
     (uri
      (string-append "https://github.com/BVLC/caffe/archive/"
                     version ".tar.gz"))
     (file-name (string-append name "-" version ".tar.gz"))
     (sha256
      (base32
       "0zx77zhaq07p2jiplpsh49n850py056q4rd4cpwm0c8qibmwklvi"))))
   (build-system cmake-build-system)
   (inputs `(("blas" ,openblas)
             ("numpy" ,python-numpy)
             ("lmdb" ,lmdb)
             ("leveldb" ,leveldb)
             ("snappy" ,snappy)
             ("protobuf" ,protobuf)
             ("hdf5" ,hdf5)
             ("gflags" ,gflags)
             ("boost" ,boost)
             ("opencv" ,opencv)
             ("glog" ,glog)))
   (synopsis "TODO")
   (description "TODO")
   (home-page "http://caffe.berkeleyvision.org/")
   (license license:gpl2)))


(define-public pommed-light
  (package
   (name "pommed-light")
   (version "1.51lw")
   (source
    (origin
     (method url-fetch)
     (uri
      (string-append "https://github.com/bytbox/pommed-light/archive/v"
                     version ".tar.gz"))
     (file-name (string-append name "-" version ".tar.gz"))
     (sha256
      (base32
       "11wi17bh2br1hp8gmq40b1hm5drm6h969505f7432zam3cm8mc8q"))))
   (build-system gnu-build-system)
   (inputs `(("libpciaccess" ,libpciaccess)
             ;; libconfuse - libasound - libaudiofile - eject - zlib
             ("glibc" ,glibc)))
   (synopsis "TODO")
   (description "TODO:DON'T USE ME!")
   (home-page "TODO")
   (license license:gpl2)))

(define-public dbus-doc
  (package
    (inherit dbus)
    (name "dbus-doc")
    (arguments
     '(#:configure-flags
       (list
        ;; Install the system bus socket under /var.
        ;"--localstatedir=/var"
        
        ;; Install the session bus socket under /tmp.
        ;"--with-session-socket-dir=/tmp"

        ;; Use /etc/dbus-1 for system-wide config.
        ;; Look for configuration file under
        ;; /etc/dbus-1.  This is notably required by
        ;; 'dbus-daemon-launch-helper', which looks for
        ;; the 'system.conf' file in that place,
        ;; regardless of what '--config-file' was
        ;; passed to 'dbus-daemon' on the command line;
        ;; see <https://bugs.freedesktop.org/show_bug.cgi?id=92458>.
        ;"--sysconfdir=/etc"
        (string-append "--datadir=" %output "/share"))))

    ))


(define-public zyre
  (package
    (name "zyre-t")
    (version "2.0.0")
    (source (origin
              (method url-fetch)
              (uri
               (string-append "https://github.com/zeromq/zyre/releases/download/v"
                              version "/" name "-" version ".tar.gz"))
              (sha256
               (base32
                "0qz2730bng1gs9xbqxhkw88qbsmszgmmrl2g9k6xrg6r3bqvsdc7"))))
    (build-system gnu-build-system)
    (inputs `(("zeromq" ,zeromq)
              ("czmq" ,czmq)
              ("libsodium" ,libsodium)))
    (synopsis "An open-source framework for proximity-based peer-to-peer applications")
    (description "Zyre provides reliable group messaging over local area networks.")
    (home-page "https://github.com/zeromq/zyre")
    (license license:mpl2.0)))


(define ad (@@ (gnu packages aspell) aspell-dictionary))
(define awl (@@ (gnu packages aspell) aspell-word-list))
;(define dwld (@@ (gnu packages aspell) define-word-list-dictionary))

(define* (ad-ton dict-name full-name
                            #:key version sha256 (prefix "aspell-"))
  (package
    (name (string-append "aspell-dict-" dict-name))
    (version version)
    (source (origin
              (method url-fetch)
              (uri (string-append "mirror://gnu/aspell/dict/" dict-name
                                  "/" prefix dict-name "-"
                                  version ".tar.bz2"))
              (sha256 sha256)))
    (build-system gnu-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'configure
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
               (zero? (system* "./configure"))))))
       #:make-flags
       (let ((out (assoc-ref %outputs "out")))
         (list (string-append "dictdir=" out "/lib/aspell")
               (string-append "datadir=" out "/lib/aspell")))
       #:tests? #f))
    (native-inputs `(("aspell" ,aspell)
                     ("which" ,which)))
    (synopsis (string-append full-name " dictionary for GNU Aspell")) ; XXX: i18n
    (description
     "This package provides a dictionary for the GNU Aspell spell checker.")
    (license license:gpl2+)
    (home-page "http://aspell.net/")))

(define-public aspell-dict-no
  (ad-ton "no" "Norsk"
      #:version "0.50-2"
      #:sha256
      (base32
       "1xvns7dwx2sc0msldj7r2hv0426913rg3dpnkxlrvnsyrxzjpbpc")))

(awl "en"
  "Hunspell dictionary for English")

;;(define-public transity
  ;; Needs node/npm!
;;  (package
;;    (name "transity")
;;    (version "0.2.1")
;;    (source (origin
;;              (method url-fetch)
;;              (uri
;;;               https://github.com/feramhq/transity/archive/v0.2.1.tar.gz
;;               (string-append "https://github.com/feramhq/transity/archive/v"
;;                              version ".tar.gz"))
;;              (sha256
;;               (base32
;;                "0jp75h0j48qdwfrpan374923saw815qr9lga7disz4wfzdhc7s97"))))
;;;    (build-system ?)
;;    (inputs `(("zeromq" ,zeromq)
;;              ("czmq" ,czmq)
;;              ("libsodium" ,libsodium)))
;;    (synopsis "TODO")
;;    (description "TODO")
;;    (home-page "https://github.com/feramhq/transity")
;;    (license license:isc)))


(define-public nextcloud
  (package
    (name "nextcloud")
    (version "13.0.1")
    (source (origin
              (method url-fetch)
              (uri
               (string-append "https://download.nextcloud.com/server/releases/"
                              name "-" version ".tar.bz2"))
              (sha256
               (base32
                "048x3x6d11m75ghxjcjzm8amjm6ljirv6djbl53awwp9f5532hsp"))))
    (build-system trivial-build-system)
    (inputs `(("php" ,php)))
    (arguments
     `(#:modules ((guix build utils))
       #:builder
       (begin
         (use-modules (guix build utils))
         (let ((out (assoc-ref %outputs "out"))
               (mkdir out))
           (copy-tree %build-inputs out)
           ;; How? wat? do? wat?
           ))))
    (synopsis "")
    (description "")
    (home-page "")
    (license license:mpl2.0)))

(define-public p7zip-nonfree
  (package
    (name "p7zip-t")
    (version "16.02")
    (source (origin
              (method url-fetch)
              (uri (string-append "mirror://sourceforge/p7zip/p7zip/"
                                  version "/p7zip_" version
                                  "_src_all.tar.bz2"))
              (sha256
               (base32
                "07rlwbbgszq8i7m8jh3x6j2w2hc9a72dc7fmqawnqkwlwb00mcjy"))
              (modules '((guix build utils)))
              ))
    (build-system gnu-build-system)
    (arguments
     `(#:make-flags
       (list (string-append "DEST_HOME=" (assoc-ref %outputs "out")) "all3")
       #:phases
       (modify-phases %standard-phases
         (replace 'configure
           (lambda* (#:key system outputs #:allow-other-keys)
             (invoke "cp"
                     (let ((system ,(or (%current-target-system)
                                        (%current-system))))
                       (cond
                        ((string-prefix? "x86_64" system)
                         "makefile.linux_amd64_asm")
                        ((string-prefix? "i686" system)
                         "makefile.linux_x86_asm_gcc_4.X")
                        (else
                         "makefile.linux_any_cpu_gcc_4.X")))
                     "makefile.machine")))
         (replace 'check
           (lambda _
             (invoke "make" "test")
             (invoke "make" "test_7z")
             (invoke "make" "test_7zr"))))))
    (inputs
     (let ((system (or (%current-target-system)
                       (%current-system))))
       `(,@(cond ((string-prefix? "x86_64" system)
                  `(("yasm" ,yasm)))
                 ((string-prefix? "i686" system)
                  `(("nasm" ,nasm)))
                 (else '())))))
    (home-page "http://p7zip.sourceforge.net/")
    (synopsis "Command-line file archiver with high compression ratio")
    (description "p7zip is a command-line port of 7-Zip, a file archiver that
handles the 7z format which features very high compression ratios.")
    (license (list license:lgpl2.1+
                   license:gpl2+
                   license:public-domain))))

(define-public i3-battery-warning
  (package
    (name "i3-battery-warning")
    (version "0.1")
    (source (local-file "/home/ton/guixsd/modules/i3-battery-warning.scm"))
    (build-system trivial-build-system)
    (propagated-inputs `(("guile" ,guile-2.2)))
    (arguments
     `(#:modules ((guix build utils))
       #:builder
       (begin
         (use-modules (guix build utils))
         (let ((out (assoc-ref %outputs "out"))
               (mkdir out))
           (copy-tree %build-inputs out)
           ))))
    (synopsis "Notifications for low battery")
    (description "Checks battery levels and shows a warning if it is low.")
    (home-page "")
    (license license:gpl3+)))

(define-public qtwebengine
  (package
    (name "qtwebengine")
    (version "5.12.0-beta2")
    (source
      (origin
        (method url-fetch)
        (uri (string-append "https://github.com/qt/archive/v"
                            version ".tar.gz"))
        (sha256
         (base32
          "1316wcsa2vg9dsbxj0ik0b2bd1h2lbjl243kv0bjxlhjwqbk6llr"))))
    (build-system cmake-build-system)

    (native-inputs
     `(
       ;("perl" ,perl)
       ("python" ,python)
       ;("ruby" ,ruby)
       ;("bison" ,bison)
       ;("flex" ,flex)
       ;("gperf" ,gperf)
       ("pkg-config" ,pkg-config)))
    (inputs
     `(
       ;("icu" ,icu4c)
       ;("glib" ,glib)
       ;("gst-plugins-base" ,gst-plugins-base)
       ;("libjpeg" ,libjpeg)
       ;("libpng" ,libpng)
       ;("libwebp" ,libwebp)
       ;("sqlite" ,sqlite)
       ;("fontconfig" ,fontconfig)
       ;("libxrender" ,libxrender)
       ("qtbase" ,qtbase)
       ("qttools" ,qttools)
       ;("qtdeclarative" ,qtdeclarative)
       ;("qtlocation" ,qtlocation)
       ;("qtmultimedia" ,qtmultimedia)
       ;("qtsensors" ,qtsensors)
       ;("qtwebchannel" ,qtwebchannel)
       ;("libxml2" ,libxml2)
       ;("libxslt" ,libxslt)
       ;("libx11" ,libx11)
       ;("libxcomposite" ,libxcomposite)
       ))

    (arguments
     '(#:tests? #f
       #:phases
       (modify-phases %standard-phases
         (replace 'configure
           ;; Use lrelease to convert TS translation files into QM files.
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (invoke "qmake"
                     (string-append "PREFIX="
                                    (assoc-ref outputs "out"))))))))
    
    (home-page "")
    (synopsis "")
    (description "")
    (license license:lgpl2.1+)))

(define-public qutebrowser-1.5.1
  (package
    ;(inherit qutebrowser)
    (name "qutebrowser")
    (version "1.5.1")
    (source (origin
             (method url-fetch)
             (uri (string-append "https://github.com/" name "/" name
                                 "archive/v" version ".tar.gz"))
             (sha256
              (base32
               "16q3dd9cffqlmh6c304jn3j8j7zdkwirmysjpaaxdqbg73rqxrjm"))))

    (build-system python-build-system)
    (native-inputs
     `(("asciidoc" ,asciidoc)))
    (inputs
     `(("python-colorama" ,python-colorama)
       ("python-cssutils" ,python-cssutils)
       ("python-jinja2" ,python-jinja2)
       ("python-markupsafe" ,python-markupsafe)
       ("python-pygments" ,python-pygments)
       ("python-pypeg2" ,python-pypeg2)
       ("python-pyyaml" ,python-pyyaml)
       ("python-attrs" ,python-attrs)
       ("python-pyqt" ,python-pyqt)))
    (propagated-inputs
       `(("qtwebengine" ,qtwebengine)))

    (arguments
     `(#:tests? #f
       #:phases
       (modify-phases %standard-phases
         (add-after 'install 'install-more
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (app (string-append out "/share/applications"))
                    (hicolor (string-append out "/share/icons/hicolor")))
               (invoke "a2x" "-f" "manpage" "doc/qutebrowser.1.asciidoc")
               (install-file "doc/qutebrowser.1"
                             (string-append out "/share/man/man1"))

               (for-each
                (lambda (i)
                  (let ((src  (format #f "icons/qutebrowser-~dx~d.png" i i))
                        (dest (format #f "~a/~dx~d/apps/qutebrowser.png"
                                      hicolor i i)))
                    (mkdir-p (dirname dest))
                    (copy-file src dest)))
                '(16 24 32 48 64 128 256 512))
               (install-file "icons/qutebrowser.svg"
                             (string-append hicolor "/scalable/apps"))

               #t))))))
    
    (home-page "https://qutebrowser.org/")
    (synopsis "Minimal, keyboard-focused, vim-like web browser")
    (description "qutebrowser is a keyboard-focused browser with a minimal
GUI.  It is based on PyQt5 and QtWebKit.")
    (license license:gpl3+)))


(define-public python-html2text
  (package
   (name "python-html2text")
   (version "2018.1.9")
   (source
    (origin
     (method url-fetch)
     (uri (pypi-uri "html2text" version))
     (sha256
      (base32
       "1m6d7ciq30adc3d1n8g6r46072n7q8kdy039pqvnnmp763xi8xb2"))))
   (build-system python-build-system)
   (home-page
    "https://github.com/Alir3z4/html2text/")
   (synopsis
    "Turn HTML into equivalent Markdown-structured text.")
   (description
    "Turn HTML into equivalent Markdown-structured text.")
   (license #f)))


(define-public freealut-1.1.0
  (package
    (inherit freealut)
    (name "freealut")
    (version "1.1.0")
    (source (origin
              (method url-fetch)
              (uri (string-append "https://github.com/vancegroup/" name
                                  "/archive/" name "_1_1_0.tar.gz"))
              (sha256
               (base32
                "1pc510mn7cnbsbh9nf7x53cf5nadlfh8mf6nw5adpiwhpdyhv263"))))))

(define-public libsoundio
  (package
   (name "libsoundio")
   (version "2.0.0")
   (source
    (origin
     (method url-fetch)
     (uri (string-append "https://github.com/andrewrk/" name
                         "/archive/" version ".tar.gz"))
     (sha256
      (base32
       "07m7ykfhy65755vq38pyqhmrbqwrrsrkzyqv7023fazgkcfgra37"))))
   (build-system cmake-build-system)
   (arguments
    '(#:tests? #f))
   (home-page
    "https://github.com/andrewrk/libsoundio")
   (synopsis
    "C library for cross-platform real-time audio input and output")
   (description
    "C library for cross-platform real-time audio input and output")
   (license #f)))
                                        ;license:mit))) TODO: license
                                        ;mit is apparently nonexisting
                                        ;in guix.

(define-public libebur128
  (package
   (name "libebur128")
   (version "1.2.4")
   (source
    (origin
     (method url-fetch)
     (uri (string-append "https://github.com/jiixyj/" name
                         "/archive/v" version ".tar.gz"))
     (sha256
      (base32
       "1n5dywkn2frnbdfcyizndqkpv69bck15wpcpmq0id2g3b8x1mr1f"))))
   (build-system cmake-build-system)
   (home-page
    "https://github.com/jiixyj/libebur128")
   (synopsis
                                        ;TODO: fix description and synopsis
    "A library implementing the EBU R128 loudness standard")
   (description
    "Libebur128 implements the EBU R128 loudness standard.")
   (license #f)))
                                        ;license:mit))) TODO: license
                                        ;mit is apparently nonexisting
                                        ;in guix.

(define-public ffmpeg-for-libgroove
  (hidden-package
   (package
     (inherit ffmpeg)
     (version "3.4")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
              (url "https://github.com/stepmania/ffmpeg.git")
              (commit "eda6effcabcf9c238e4635eb058d72371336e09b")))
        (sha256
         (base32 "1by8rmbva8mfrivdbbkr2gx4kga89zqygkd4cfjl76nr8mdcdamb"))
        (file-name (git-file-name "ffmpeg" version))))
     (arguments
      (substitute-keyword-arguments (package-arguments ffmpeg)
        ((#:configure-flags flags)
         '(list
           "--enable-shared"
           "--disable-static"
           "--enable-gpl"                
           "--disable-doc"
           "--disable-debug"))))
     (inputs
      '()))))

(define-public libgroove
  (package
   (name "libgroove")
   (version "4.3.0")
   (source
    (origin
     (method url-fetch)
     (uri (string-append "https://github.com/andrewrk/" name
                         "/archive/" version ".tar.gz"))
     (sha256
      (base32
       "0dink7r6m6nq670gpl1cmn23had8gj4fyf8388yn3abqy2b8ixkn"))))
   (build-system cmake-build-system)
   (inputs
    `(("libebur128" ,libebur128)
      ("libsoundio" ,libsoundio)
      ("chromaprint" ,chromaprint)
      ("sdl2" ,sdl2)
      ("ffmpeg" ,ffmpeg-for-libgroove)))
;   (arguments '(#:configure-flags (list "-Wno-errors")))
   (home-page
    "https://github.com/andrewrk/libgroove")
   (synopsis
                                        ;TODO: Fix synopsis and description
    "streaming audio processing library")
   (description
    "streaming audio processing library")
   (license #f)))
                                        ;license:mit))) TODO: license
                                        ;mit is apparently nonexisting
                                        ;in guix.

(define-public ampache
  (package
   (name "ampache")
      (version "3.9.0")
      (source (origin
               (method url-fetch)
               (uri (string-append "https://github.com/" name "/" name
                                   "/releases/download/" version "/" name
                                   "-" version "_all.zip"))
               (sha256
                (base32
                 "14mq8092rscdazgb3ryg55b9y1wlksw7ic57rrvnrsmr1q42w8rc"))))
      (build-system gnu-build-system)
      (arguments
       '(#:tests? #f
         #:phases
         (modify-phases %standard-phases
           (delete 'configure)
           (delete 'build)
           (replace 'install
             (lambda _
               (let ((lib (string-append %output "/lib/" name)))
                 (mkdir-p lib)
                 (copy-recursively "." lib))
               #t)))))
      (inputs
       `(("php" ,php)
         ))
      (home-page "")
      (synopsis "")
      (description
       "")
      (license license:asl2.0))) ;TODO: License

;;(define-public exa
;;  (package
;;    (name "exa")
;;    (version "0.9.0")
;;    (source (origin
;;              (method url-fetch)
;;              (uri
;;               (string-append "https://github.com/ogham/" name
;;                              "/archive/v" version ".tar.gz"))
;;              (sha256
;;               (base32
;;                "10zpzq483qi7xh0g4vx4j6vfhvjkhdqjg8wwvrwa44h5mkzl7rwn"))))
;;    (build-system cargo-build-system)
;;    (arguments
;;     `(#:cargo-inputs
;;       (("rust-ansi-term" ,rust-ansi-term))))
;;    (native-inputs `(("libgit2" ,libgit2)))
;;    (synopsis "A modern replacement for ls.")
;;    (description "")
;;    (home-page "")
;;    (license #f)))
;;
;;(define-public rust-ansi-term-0.12
;;  (package
;;    (inherit rust-ansi-term)
;;    (name "rust-ansi-term")
;;    (version "0.12.1")
;;    (source (origin
;;             (method url-fetch)
;;             (uri (crate-uri "ansi_term" version))
;;             (file-name (string-append name "-" version ".tar.gz"))
;;             (sha256
;;              (base32
;;               "1ljmkbilxgmhavxvxqa7qvm6f3fjggi7q2l3a72q9x0cxjvrnanm"))))
;;    (arguments
;;     `(#:cargo-inputs
;;       (("rust-winapi" ,rust-winapi))
;;       (("rust-serde" ,rust-serde))))))
;;
;;(define-public rust-serde
;;  (package
;;    (name "rust-serde")
;;    (version "1.0.101")
;;    (source (origin
;;              (method url-fetch)
;;              (uri
;;               (string-append "https://github.com/serde-rs/" name
;;                              "/archive/v" version ".tar.gz"))
;;              (sha256
;;               (base32
;;                "1v1vavzafpgg105r2ik9p3vh9n39k6lfa6bzn41y4vbkcvj4s4yz"))))
;;    (build-system cargo-build-system)
;;    (arguments
;;     `(#:cargo-inputs
;;       (("rust-proc-macro2" ,rust-proc-macro2))))
;;;    (native-inputs `(("libgit2" ,libgit2)))
;;    (synopsis "")
;;    (description "")
;;    (home-page "")
;;    (license #f)))
;;
;;(define-public rust-proc-macro2-1.0.4
;;  (package
;;    (inherit rust-proc-macro2)
;;    (name "rust-proc-macro2")
;;    (version "1.0.4")
;;    (source (origin
;;             (method url-fetch)
;;             (uri (crate-uri "proc-macro2" version))
;;             (file-name (string-append name "-" version ".tar.gz"))
;;             (sha256
;;              (base32
;;               "1k5brpv0c20whjhjvyjwksg4fgdcgnxjx53248kfsw7cfk67gp5g"))))
;;    (arguments
;;     `(#:cargo-inputs (("rust-unicode-xid" ,rust-unicode-xid))
;;       #:cargo-development-inputs (("rust-quote" ,rust-quote))))))
;;
;;(define-public rust-quote-1.0.2
;;  (package
;;    (inherit rust-quote)
;;    (name "rust-quote")
;;    (version "1.0.2")
;;    (source (origin
;;             (method url-fetch)
;;             (uri (crate-uri "quote" version))
;;             (file-name (string-append name "-" version ".tar.gz"))
;;             (sha256
;;              (base32
;;               "1zkc46ryacf2jdkc6krsy2z615xbk1x8kp1830rcxz3irj5qqfh5"))))
;;    (arguments
;;     `(#:cargo-inputs (("rust-proc-macro2" ,rust-proc-macro2))
;;;       #:cargo-development-inputs (("rust-quote" ,rust-quote))))))
;;       ))
;;    ))
;;
;;(define ogre-for-opendungeons
;;  (package
;;    (inherit ogre)
;;    (name "ogre")
;;    (version "1.9.1")
;;    (source (origin
;;             (method url-fetch)
;;             (uri (string-append "https://github.com/ogrecave/" name
;;                         "/archive/v" version ".tar.gz"))
;;             (sha256
;;              (base32
;;               "1b5993p59dl7pd441hd3vz87lm0fmz1ia5dqy51wlikjfnnizvzi"))))
;;    ))
;;
;;
;;(define ois-for-opendungeons
;;  (package
;;    (name "ois")
;;    (version "1.3")
;;    (source (origin
;;              (method url-fetch)
;;              (uri (string-append "https://github.com/wgois/" name
;;                                  "/archive/v" version ".tar.gz"))
;;              (sha256
;;               (base32
;;                "0ij42lnbpmgp1j2zpvahcjy6w7fams3a8x68nj94qnb2g9vcbkph")))) ;; 1.3
;;;;                "0xawwcdfr2p4mwwxb0i259bi9b2ywq81sjw97sqgpgy01jd2iada")))) ;; 1.4
;;    (build-system gnu-build-system)
;;    (arguments
;;     `(#:tests? #f))                    ; no test suite
;;    (inputs
;;     `(("libx11" ,libx11)
;;       ("libxaw" ,libxaw)))
;;    ;; Fails with:
;;    ;;    ./linux/LinuxJoyStickEvents.cpp:100:77: error: ‘read’ was not declared in this scope
;;    ;;   int ret = read(mJoyStick, &js, sizeof(struct input_event) * JOY_BUFFERSIZE);
;;    (native-inputs
;;     `(("automake" ,automake)
;;       ("libtool" ,libtool)
;;       ("pkg-config" ,pkg-config)
;;       ("autoconf" ,autoconf)))
;;    (synopsis "Object Oriented Input System")
;;    (description
;;     "Cross Platform Object Oriented Input Lib System is a cross platform,
;;simple solution for using all kinds of Input Devices (Keyboards, Mice,
;;Joysticks, etc) and feedback devices (e.g. force feedback).  Meant to be very
;;robust and compatible with many systems and operating systems.")
;;    (home-page "https://github.com/wgois/OIS")
;;    (license license:zlib)))
;;
;;(define-public opendungeons
;;  (package
;;   (name "opendungeons")
;;   (version "0.7.1")
;;   (source
;;    (origin
;;     (method url-fetch)
;;     (uri (string-append "https://github.com/" name "/" name
;;                         "/archive/" version ".tar.gz"))
;;     (file-name (string-append name "-" version ".tar.gz"))
;;     (sha256
;;      (base32
;;       "1pic4964mr03r989ln0vyk775n2c05ry0683dxrb5mjsajpsqhbm"))))
;;   (build-system cmake-build-system)
;;   (inputs
;;                                        ; Opendungeons has not been
;;                                        ; updated since 2016. Thus it
;;                                        ; needs OGRE 1.9.1
;;    `(("ogre" ,ogre-for-opendungeons)
;;      ("boost" ,boost)
;;      ("cegui" ,cegui)
;;      ("ois" ,ois-for-opendungeons)
;;      ("sfml" ,sfml)))
;;   (native-inputs
;;         `(("pkg-config" ,pkg-config)))
;;   (arguments
;;    `(#:tests? #f))
;;   (home-page
;;    (string-append "https://github.com/" name "/" name))
;;   (synopsis
;;    "Real time strategy game about dungeon building")
;;   (description
;;    "OpenDungeons is an open source, real time strategy game sharing
;;game elements with the Dungeon Keeper series and Evil Genius.  Players
;;build an underground dungeon which is inhabited by creatures.  Players
;;fight each other for control of the underground by indirectly commanding
;;their creatures, directly casting spells in combat, and luring enemies
;;into sinister traps.")
;;   (license license:gpl3+)))

(define-public cegui
  (package
   (name "cegui")
   (version "0.8.7")
   (source
    (origin
     (method url-fetch)
     (uri (string-append "https://bitbucket.org/" name "/" name
                         "/downloads/" name
                         "-" version ".tar.bz2"))
     (sha256
      (base32
       "067562s71kfsnbp2zb2bmq8zj3jk96g5a4rcc5qc3n8nfyayhldk"))))
   (build-system cmake-build-system)
   (inputs
    `(("glm" ,glm)
      ("boost" ,boost)
      ("ogre" ,ogre)))
   (arguments
    `(#:tests? #f))
   (home-page "http://cegui.org.uk/")
   (synopsis
    "Graphical user interface library for C++")
   (description
    "Crazy Eddie's GUI is a graphical user interface library for the
programming language C++.")
   (license license:expat))) ;; MIT license


(define-public kanshi
  (package
    (name "kanshi")
    ;; kanshi doesn't seem to have versions, so here is the latest commit
    (version "5a30abdf0b3b39ea21298bea91f28924373e4f0b")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/emersion/kanshi.git")
             (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32 "0fs52f27kqpsnmqaqmd9abcxkby0cq02ab1chhgx1d41yq9hijpl"))))
    (build-system meson-build-system)

    ;; Build fails with:
    ;; meson.build:59:1: ERROR: Program(s) ['/usr/local/bin/scdoc'] not found or not executable
    (inputs `(("wayland" ,wayland)
              ))
    (native-inputs `(("pkg-config" ,pkg-config)
                     ("scdoc" ,scdoc)
                     ("wayland-protocols" ,wayland-protocols)))
    (home-page "https://github.com/emersion/kanshi")
    (synopsis "autorandr for sway wm")
    (description "Kanshi is a ")
    (license license:expat)))       ; MIT license


(define-public vcmi
  (package
   (name "vcmi")
   (version "7f242c9bbb75243558bd41d6cc0662f129c80ce8");"0.99")
   (source
    (origin
     (method git-fetch)
     (uri (git-reference
           (url "https://github.com/krkos/vcmi.git")
           (commit version)
           (recursive? #t)))
     (file-name (git-file-name name version))
;;     (method url-fetch)
;;     (uri
;;      (string-append "https://github.com/krkos/vcmi/archive/develop.tar.gz"))
;;      (string-append "https://github.com/vcmi/vcmi/archive/"
;;                     version ".tar.gz"))
;;     (file-name (string-append name "-" version ".tar.gz"))
;;     (patches '("/home/ton/guixsd/modules/patches/1075-Fix-build-with-Boost-versioni-1.70.patch"))
;;     (patches '("/home/ton/guixsd/modules/patches/1075-Fix-build-with-Boost-versioni-1.70.patch"))
     (sha256
      (base32
       "0342f6lgxyg8m8mmmm598wynkpq58jdvwbr072livjbrp2n4fa1z"))))
;;       "0blh1y9nawwgq8x13hbdn3dx6lg7800bijqrykf8nk05gsflbwmp")))) ;; 0.99
   (build-system cmake-build-system)
   (inputs `(("pkg-config" ,pkg-config)
             ("sdl-union" ,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf)))
             ("zlib" ,zlib)
             ("qtbase" ,qtbase)
             ("ffmpeg" ,ffmpeg)
             ("minizip" ,minizip)
             ("boost" ,boost)))
   (arguments
    `(#:tests? #f))
   (synopsis "TODO")
   (description "TODO")
   (home-page "https://github.com/vcmi/vcmi/")
   (license #f)))

(define-public nq
  (package
   (name "nq")
   (version "0.3.1")
   (source
    (origin
     (method url-fetch)
     (uri (string-append "https://github.com/leahneukirchen/nq/archive/v"
                         version ".tar.gz"))
     (sha256
      (base32
       "0jrhxbs2x8410x418qjr5898dwlywwd1hgm4z2k4dqizhi3sg5w8"))))
;   (inputs
;    `(("libnl" ,libnl)))
;   (native-inputs
;    `(("pkg-config" ,pkg-config)))
   (build-system gnu-build-system)
   (arguments
    `(;; Batctl only has a makefile. Thus we disable tests and
      ;; configuration, passing in a few make-flags.
      #:phases (modify-phases %standard-phases (delete 'configure))))
;      #:make-flags
;      (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
;            (string-append "PKG_CONFIG=" (assoc-ref %build-inputs "pkg-config")
;                           "/bin/pkg-config")
;            "CC=gcc")))
   (home-page "")
   (synopsis "")
   (description "")
   (license license:gpl2)))

(define-public unknown-horizons-ton
  (package
    (inherit unknown-horizons)
    (name "unknown-horizons-ton")
    (version "265f8cf4fa13c191845127e27e2e016fdb07711a")
    (source (origin
             (method url-fetch)
             (uri (string-append "https://codeload.github.com/unknown-horizons/"
                                 "unknown-horizons/tar.gz/" version))
             (file-name (string-append name "-" version ".tar.gz"))
             (sha256
              (base32
               "1rky41rlm26m2iv1nvizz9qkgp8ma6x4d2nslpa9w51h6mzn8xxv"))))
    (build-system python-build-system)
    (arguments
     '(#:tests? #f
       #:phases
       (modify-phases %standard-phases
         (add-before 'build 'set-HOME
           (lambda _
             (setenv "HOME" "/tmp")))
         (add-after 'build 'build-extra
           (lambda _
             (invoke "python3" "./setup.py" "build_i18n")
             (invoke "python3" "horizons/engine/generate_atlases.py" "2048")
             #t))
         (add-after 'install 'patch
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
               (substitute* (string-append out "/bin/unknown-horizons")
                 (("os\\.chdir\\(get\\_content\\_dir\\_parent_path\\(\\)\\)")
                  (string-append "os.chdir(\""
                                 (assoc-ref outputs "out")
                                 "/share/unknown-horizons\")"))))
             #t))
         ;; TODO: Run GUI tests as well
         (add-before 'check 'subs!
           (lambda _
             (substitute* "horizons/constants.py"
               (("IS_DEV_VERSION = False")
                "IS_DEV_VERSION = True"))
             (invoke "pytest" "tests")
             (substitute* "horizons/constants.py"
               (("IS_DEV_VERSION = True")
                "IS_DEV_VERSION = False"))
             #t)))))
    (inputs
     `(("fifengine" ,fifengine)
       ("python:tk" ,python "tk")
       ("python-pillow" ,python-pillow)
       ("python-distro" ,python-distro)
       ("python-pyyaml" ,python-pyyaml)))
    (native-inputs
     `(("intltool" ,intltool)
       ("git" ,git)

       ;; Required for tests
       ("python-greenlet" ,python-greenlet)
       ("python-polib" ,python-polib)
       ("python-pytest" ,python-pytest)
       ("python-pytest-mock" ,python-pytest-mock)))
    (home-page "http://unknown-horizons.org/")
    (synopsis "Isometric realtime strategy, economy and city building simulation")
    (description
     "Unknown Horizons is a 2D realtime strategy simulation with an emphasis
on economy and city building.  Expand your small settlement to a strong and
wealthy colony, collect taxes and supply your inhabitants with valuable
goods.  Increase your power with a well balanced economy and with strategic
trade and diplomacy.")
    (license (list
              license:gpl2+        ; Covers code
              license:expat        ; tests/dummy.py, ext/polib.py
              license:cc-by-sa3.0  ; Covers some media content
              license:cc-by3.0     ; Covers some media content
              license:bsd-3))))    ; horizons/ext/speaklater.py

(define-public jitsi
  (package
   (name "jitsi")
   (version "5622")
   (source
    (origin
     (method url-fetch)
     (uri (string-append "https://github.com/jitsi/jitsi/archive/"
                         version ".tar.gz"))
     (sha256
      (base32
       "0vxpp4k5kf44cankf4kzl3c7vfvvl567b8fnx3jzn8dx3yi96ykv"))))
   (build-system ant-build-system)
   ;; TODO: Needs ant rebuild as build command
;   (arguments
 ;   `(#:phases (modify-phases %standard-phases (delete 'configure))))
   (home-page "")
   (synopsis "")
   (description "")
   (license license:gpl2)))

(define-public gnunet-ton
  (package
    (inherit gnunet-gtk)
    (name "gnunet-ton")
    (build-system glib-or-gtk-build-system)))
